<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .content {
            width: 100px;
            height: 50px;
            padding: 10px;
            border: 5px solid red;
            margin: 15px;
            box-sizing: border-box;
        }
    </style>
</head>
<body>
    <div class="content">wr</div>
    <section id="main">
        <div class="box"></div>
        </section>
    <script>
        var desW=640;
        var winW=document.documentElement.clientWidth;
        var ratio=winW/desW;
        var oMain=document.getElementById("main");
        console.log(desW)
        if(winW>desW){
            oMain.style.width=desW+"px";
            oMain.style.margin="0 auto";
        }else{
            document.documentElement.style.fontSize=ratio*100+"px";
        }
        
    </script>

</body>
</html>